package com.zmn.plat.common.dictionary;

/**
 * 合同收付阶段枚举
 *
 * @author linfeng
 * @since 2020/05/15 14:56:30
 */
public enum ContractPaymentStageEnum {

    /**
     * values
     */
    DOWNPAYMENT(1, "首付款"),
    THESECONDSTAGE(2, "第二阶段"),
    THETHIRDSTAGE(3, "第三阶段"),
    THEFOURTHSTAGE(4, "第四阶段"),
    FINALPAYMENT(5, "尾款"),
    ;

    private Integer code;
    private String name;

    ContractPaymentStageEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ContractPaymentStageEnum of(Integer code) {
        if (code == null || code == 0) {
            return DOWNPAYMENT;
        }
        switch (code) {
            case 1:
                return DOWNPAYMENT;
            case 2:
                return THESECONDSTAGE;
            case 3:
                return THETHIRDSTAGE;
            case 4:
                return THEFOURTHSTAGE;
            case 5:
                return FINALPAYMENT;
            default:
                return DOWNPAYMENT;
        }
    }
}
